<template>
  <div class="outbound-container">
    <!-- 页面内状态提示 -->
    <div v-if="banner.visible" :class="['status-banner', banner.type]">
      <span class="status-icon">{{ banner.type === 'success' ? '✓' : (banner.type === 'error' ? '!' : '…') }}</span>
      <span>{{ banner.text }}</span>
    </div>

    <!-- 页面标题 -->
    <div class="page-header">
      <div class="header-subtitle">收货任务（{{ DeliveryNote.length }}）</div>
    </div>
    
    <!-- 查询功能区域 -->
    <div class="search-container">
      <div class="search-form">
        <div class="search-row">
          <div class="search-input-wrapper">
            <input type="text" class="search-input" v-model="searchForm.barcode" placeholder="请输入商品条码搜索" @input="handleSearchInput">
            <button class="search-btn-icon" @click="getYbb()">
              <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                <circle cx="11" cy="11" r="8"></circle>
                <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
              </svg>
            </button>
          </div>
          <button class="refresh-btn" @click="refreshData" title="刷新数据">
            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
              <path d="M23 4v6h-6"></path>
              <path d="M1 20v-6h6"></path>
              <path d="M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15"></path>
            </svg>
          </button>
        </div>
      </div>
    </div>

    <!-- 收货单卡片列表 -->
    <div class="outbound-list" v-if="DeliveryNote && DeliveryNote.length > 0">
      <div class="outbound-card" v-for="(outbound, outboundIdx) in DeliveryNote" :key="outboundIdx">
        <!-- 出货单整体卡片容器 -->
        <div class="outbound-container-card" @click="onOutboundCardClick(outbound)">
          <!-- 出货单头部信息 -->
          <div class="outbound-header">
            <div class="header-main">
              <div class="outbound-id">{{ outbound['6868dafac66aa1c3b15b0312'] || '—' }}</div>
              <div class="outbound-title">{{  outbound['689ad8a3f23d51578296dfbc'] || '—'  }}</div>
             </div>
            
            <div class="outbound-details">

              <!-- SKUID -->
              <div class="detail-item">
                <span class="detail-label">SKUID: {{  outbound['687859e0a462f1cb468b32c8'] || '—'  }}  </span>
                   </div>

                   <div class="detail-item">
                <span class="detail-label">商品条码: {{  outbound['689ad90af23d51578296e021'] || '—'  }}  </span>
                   </div>

              <div class="quantity-row">
                <div class="quantity-item">
                  <span class="quantity-label">计划入库数</span>
                  <span class="quantity-value">{{ outbound["686f6f52f7607b6cf05f8c9c"] ? outbound["686f6f52f7607b6cf05f8c9c"] : 0 }}</span>
                </div>
                <div class="quantity-item">
                  <span class="quantity-label">实际入库数</span>
                  <span class="quantity-value">{{ outbound["68872058427a9931f8181aa6"] || 0 }}</span>
                </div>
              </div>
            </div>
          </div>



        </div>
      </div>
    </div>
    
    <!-- 固定在底部的批量收货完成按钮 -->
    <div class="fixed-bottom-button" v-if="DeliveryNote && DeliveryNote.length > 0">
      <button class="btn-complete" @click="handleCompleteAll">
        <span class="btn-icon">✓</span>
        <span class="btn-text">
          {{ `收货完成 (${DeliveryNote.length}条)` }}
        </span>
      </button>
    </div>


    
  </div>
</template>

<script setup>
import { ref, watch, reactive } from 'vue';
import { useRouter } from 'vue-router';
import { api, config, utils } from 'mdye';
import { showConfirmDialog, showLoadingToast, showToast } from 'vant';
import axios from 'axios';
import { WORKSHEETS } from '../utils/constant';
import { cdx } from '../utils/instances';

const props = defineProps({
  receipts: { type: Array, default: () => [] }
});

const router = useRouter();
const DeliveryNote = ref([]);
const originalDeliveryNote = ref([]); // 保存原始数据，用于搜索过滤

const isComplete = ref(false);

// 搜索条件
const searchForm = reactive({
  barcode: ''
});


// 状态提示
const banner = ref({ visible: false, type: 'info', text: '' });
const showBanner = (text, type = 'info', duration = 3000) => {
  banner.value = { visible: true, type, text };
  if (duration > 0) {
    setTimeout(() => { banner.value.visible = false; }, duration);
  }
};

const showLoading = ref(false);

const WORKSHEET_IDS = {
  receipt: '6868bde9c66aa1c3b15afaf4'
};

// 搜索功能实现
const getYbb = () => {
  const searchBarcode = searchForm.barcode.trim();
  
  if (!searchBarcode) {
    // 如果搜索框为空，显示所有数据
    DeliveryNote.value = [...originalDeliveryNote.value];
    showBanner('已显示所有收货单数据', 'info', 2000);
    return;
  }
  
  // 根据商品条码过滤数据
  const filteredData = originalDeliveryNote.value.filter(item => {
    const itemBarcode = item['689ad90af23d51578296e021'] || '';
    return itemBarcode.toLowerCase().includes(searchBarcode.toLowerCase());
  });
  
  DeliveryNote.value = filteredData;
  
  if (filteredData.length === 0) {
    showBanner(`未找到条码为 "${searchBarcode}" 的商品`, 'info', 3000);
  } else {
    showBanner(`找到 ${filteredData.length} 条匹配记录，收货完成时将只处理这些数据`, 'success', 3000);
  }
};

// 清空搜索
const clearSearch = () => {
  searchForm.barcode = '';
  DeliveryNote.value = [...originalDeliveryNote.value];
  showBanner('已清空搜索条件', 'info', 2000);
};

// 监听搜索框输入，支持实时搜索
const handleSearchInput = () => {
  if (searchForm.barcode.trim() === '') {
    // 搜索框为空时，显示所有数据
    DeliveryNote.value = [...originalDeliveryNote.value];
  }
};

// 刷新收货单数据
const refreshData = async () => {
  try {
    console.log('[OutboundOrder] 开始刷新数据...');
    
    if (!props.receipts || props.receipts.length === 0) {
      console.warn('[OutboundOrder] 没有receipts数据，无法刷新');
      return;
    }
    
    // 重新获取数据
    const res = await getData(props.receipts);
    console.log('[OutboundOrder] 刷新获取到的数据结果:', res);
    
    if (res && res.length > 0) {
      // 应用与 watch 函数相同的数据过滤逻辑
      const processedData = res.filter(item => {
        if(item['689bf9c1ad18b78d3f356f68'] != '收货完成') {
          return item
        }
      });

      console.log('[OutboundOrder] 刷新后过滤的数据:', processedData);
      
      // 更新原始数据和当前显示数据
      originalDeliveryNote.value = [...processedData];
      
      // 如果当前有搜索条件，重新应用搜索过滤
      if (searchForm.barcode.trim()) {
        const filteredData = processedData.filter(item => {
          const itemBarcode = item['689ad90af23d51578296e021'] || '';
          return itemBarcode.toLowerCase().includes(searchForm.barcode.trim().toLowerCase());
        });
        DeliveryNote.value = filteredData;
        console.log(`[OutboundOrder] 刷新后应用搜索过滤，显示 ${filteredData.length} 条记录`);
      } else {
        DeliveryNote.value = [...processedData];
        console.log(`[OutboundOrder] 刷新后显示所有数据，共 ${processedData.length} 条记录`);
      }
      
      console.log('[OutboundOrder] 数据刷新成功');
    } else {
      console.warn('[OutboundOrder] 刷新获取到的数据为空');
      originalDeliveryNote.value = [];
      DeliveryNote.value = [];
    }
    
  } catch (error) {
    console.error('[OutboundOrder] 刷新数据失败:', error);
    throw error;
  }
};


const getData = async (arr) => {
  try {
    
    if (!arr || arr.length === 0) {
      console.warn('[OutboundOrder] rowid数组为空');
      return [];
    }
    
    const result = await cdx.getFilterRows({
        worksheetId: WORKSHEETS.SHOU_HUO,
        filters: [
          {
            controlId: 'rowid',
            dataType: 2,
            spliceType: 1,
            filterType: 2,
            values: arr,
          }
        ]
      });
      console.log('getData:', result);
      
    
      return result.rows;
    
  } catch (error) {
    console.error('[OutboundOrder] 获取数据失败:', error);
    return [];
  }
};

// 监听 receipts 变化
watch(() => props.receipts, async (newReceipts) => {
  try {
    console.log('[OutboundOrder] 收到新的 receipts:', newReceipts);
    
    if (!newReceipts || newReceipts.length === 0) {
      console.warn('[OutboundOrder] receipts 为空，清空数据');
      DeliveryNote.value = [];
      return;
    }
    // 获取收货单数据
    const res = await getData(newReceipts);
    
          if (res && res.length > 0) {
     
            // 过滤状态为收货完成的收货单数据
            const processedData = res.filter(item => {
          if(item['6868bee2c66aa1c3b15afb78'] != '收货完成') {
            return item
          }
        })

        console.log(processedData);
        
        
        // 保存原始数据用于搜索过滤
        originalDeliveryNote.value = [...processedData];
        DeliveryNote.value = [...processedData];
        
        console.log('[OutboundOrder] 数据更新成功，共', processedData.length, '条记录');
      } else {
        console.warn('[OutboundOrder] 获取到的数据为空');
        originalDeliveryNote.value = [];
        DeliveryNote.value = [];
      }
    
  } catch (e) {
    console.error('[OutboundOrder] 处理 receipts 失败:', e);
    DeliveryNote.value = [];
  }
}, { immediate: true });

// 点击出货单卡片，跳转到 Listing 页面
const onOutboundCardClick = (outbound) => {
  try {
    const cleanReceipt = JSON.parse(JSON.stringify(outbound));
    console.log('cleanReceipt:', cleanReceipt);
  
    router.push({ name: 'listing', state: { receipt: cleanReceipt } });
  } catch (e) {
    console.error('[OutboundOrder] 跳转 Listing 失败:', e);
  }
};

// 装卸服务选择状态
const selectedUnloadService = ref(false);

// 处理所有收货完成
const handleCompleteAll = async () => {
  try {
    // 显示装卸服务选择弹窗
    const unloadResult = await showConfirmDialog({
      title: '本单是否使用',
      message: '装卸服务',
      confirmButtonText: '是',
      cancelButtonText: '否',
      confirmButtonColor: '#1989fa'
    });
    
    // 用户选择"是" - 使用装卸服务
    selectedUnloadService.value = true;
    console.log('用户选择使用装卸服务');
    
    // 继续显示收货完成确认弹窗
    await showConfirmDialog({
      title: '结束作业，确认入库',
      message: '',
      confirmButtonText: '确认收货完成',
      cancelButtonText: '取消',
      confirmButtonColor: '#07c160'
    });

    isComplete.value = true;
    showLoading.value = true;

    showLoadingToast({
       message: '加载中...',
       forbidClick: showLoading.value,
    });

    
    // 用户确认收货完成，开始执行
    await executeCompleteProcess();
    
  } catch (error) {

    if ( !selectedUnloadService.value ) {
      try {
        // 继续显示收货完成确认弹窗
    await showConfirmDialog({
      title: '结束作业，确认入库',
      message: '',
      confirmButtonText: '确认收货完成',
      cancelButtonText: '取消',
      confirmButtonColor: '#07c160'
    });

    isComplete.value = true;
        
      } catch (error) {

        showLoadingToast({
       message: '加载中...',
       forbidClick: showLoading.value,
    });
      }
 
      await executeCompleteProcess();
    }

    showLoadingToast({
       message: '加载中...',
       forbidClick: showLoading.value,
    });

    await executeCompleteProcess();
  }
};

// 执行收货完成流程
const executeCompleteProcess = async () => {
  try {
    showBanner('正在处理中…', 'info', 0);

    if(!selectedUnloadService.value && !isComplete.value){
      return;
    }
    
    // 确定要处理的数据：如果有搜索条件则使用搜索结果，否则使用所有数据
    const dataToProcess = searchForm.barcode.trim() ? DeliveryNote.value : originalDeliveryNote.value;
    
    if (!dataToProcess || dataToProcess.length === 0) {
      showBanner('没有可处理的数据', 'error', 3000);
      return;
    }
    
    console.log(`[OutboundOrder] 准备处理 ${dataToProcess.length} 条收货单数据`);
    if (searchForm.barcode.trim()) {
      console.log(`[OutboundOrder] 当前搜索条件: "${searchForm.barcode.trim()}"`);
    } else {
      console.log('[OutboundOrder] 无搜索条件，处理所有数据');
    }
    
    // 如果选择使用装卸服务，先调用装卸服务API
    if (selectedUnloadService.value) {
      const unloadUrl = 'https://www.dachen.vip/api/workflow/hooks/Njg5YzJmNjRjM2FkOTY1Y2IxMWUzMDU4';
      const unloadPayload = dataToProcess.map(item => item['rowid']);
      
      console.log('[OutboundOrder] 装卸服务API payload:', unloadPayload);
      
      // 调用装卸服务API
      await axios.post(unloadUrl, unloadPayload, {
        headers: { 'Content-Type': 'application/json' }
      });
      
      console.log('装卸服务确认成功');
      selectedUnloadService.value = false
    }

    if(isComplete.value){
   
    // 然后调用收货完成API
    const url = 'https://www.dachen.vip/api/workflow/hooks/Njg5YzJkNGFjM2FkOTY1Y2IxMWUxZjgz';
    const payload = dataToProcess.map(item => item['rowid']);
    
    console.log('[OutboundOrder] 收货完成API payload:', payload);
    
    // 调用收货完成API
    const res = await axios.post(url, payload, {
      headers: { 'Content-Type': 'application/json' }
    });
    
    console.log('收货完成成功');
    isComplete.value = false;
    
    }
 
    // 根据处理的数据类型显示不同的成功消息
    if (searchForm.barcode.trim()) {
      showBanner(`收货完成成功！共处理 ${dataToProcess.length} 条搜索结果`, 'success', 3000);
    } else {
      showBanner(`收货完成成功！共处理 ${dataToProcess.length} 条收货单`, 'success', 3000);
    }
    
    // 收货完成后重新获取数据
    showBanner('正在刷新数据...', 'info', 0);
    
    try {
      // 延迟3秒后重新获取数据，确保后端有足够时间处理
      setTimeout(async () => {
        await refreshData();
        showLoading.value = false;
      }, 3000);
    } catch (refreshError) {
      console.error('刷新数据失败:', refreshError);
    }
    
  } catch (error) {
    if (error.response) {
      // API调用失败
      console.error('操作失败:', error.response.data);
      showToast('操作失败，请稍后重试');
      showLoading.value = false;
    } else {
      // 其他错误
      console.error('操作失败:', error);
      showToast('操作失败，请稍后重试');
      showLoading.value = false;
    }
  }
};
</script>

<style scoped>
/* 页面背景与入库计划单统一 */
.outbound-container {
  background: #ffffff;
  min-height: 100vh;
  padding: 16px;
  padding-bottom: 100px; /* 为固定底部按钮留出空间 */
  color: #000000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 页面内状态提示 */
.status-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 16px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
}

.status-banner .status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 12px;
}

.status-banner.info {
  background: rgba(248, 179, 0, 0.1);
  color: #000000;
  border-color: #f8b300;
}

.status-banner.info .status-icon {
  background: #f8b300;
  color: #ffffff;
}

.status-banner.success {
  background: rgba(248, 179, 0, 0.1);
  color: #000000;
  border-color: #f8b300;
}

.status-banner.success .status-icon {
  background: #f8b300;
  color: #ffffff;
}

.status-banner.error {
  background: rgba(248, 179, 0, 0.1);
  color: #000000;
  border-color: #f8b300;
}

.status-banner.error .status-icon {
  background: #f8b300;
  color: #ffffff;
}

/* 页面标题样式（与入库计划单一致） */
.page-header {
  background: #f8b300;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  text-align: center;
  color: #000000;
  box-shadow: 0 8px 32px rgba(248, 179, 0, 0.3);
}
.header-icon { font-size: 28px; margin-bottom: 8px; }

/* 固定在底部的批量收货完成按钮 */
.fixed-bottom-button {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  text-align: center;
  width: calc(100% - 32px);
  max-width: none;
}

.btn-complete {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #0ca472;
  color: #ffffff;
  border: none;
  border-radius: 16px;
  padding: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(12, 164, 114, 0.3);
  transition: all 0.3s ease;
  width: 100%;
  justify-content: center;
}

.btn-complete:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(12, 164, 114, 0.4);
}

.btn-complete:active {
  transform: translateY(0);
}

.btn-icon {
  font-size: 18px;
  font-weight: bold;
}

.btn-text {
  font-size: 16px;
}
.header-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.header-subtitle { font-size: 14px; opacity: 0.9; }

/* 查询功能区域样式 */
.search-container {
  background: transparent;
  padding: 0;
  margin-bottom: 14px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.search-form {
  display: flex;
  flex-direction: column;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 10px 40px 10px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  font-size: 14px;
  color: #000000;
  background: white;
  transition: all 0.2s ease;
  height: 40px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
  outline: none;
  border-color: #f8b300;
  box-shadow: 0 0 0 2px rgba(248, 179, 0, 0.2);
}

.search-input::placeholder {
  color: #000000;
}

.search-btn-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: #f8b300;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #000000;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(248, 179, 0, 0.3);
}

.search-btn-icon:hover {
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 3px 10px rgba(248, 179, 0, 0.4);
}

/* 刷新按钮样式 */
.refresh-btn {
  background: #f8b300;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #000000;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(248, 179, 0, 0.3);
  flex-shrink: 0;
}

.refresh-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(248, 179, 0, 0.4);
}

.refresh-btn:active {
  transform: scale(0.95);
}

.refresh-btn svg {
  width: 18px;
  height: 18px;
}

/* 通用卡片（与入库计划单 plan-card 统一风格） */
.card,
.task-card {
  background: white;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card::before,
.task-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  background: #f8b300;
}

.card:hover,
.task-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

.card-content { min-height: 40px; }

.line { font-size: 14px; line-height: 22px; color: #000000; }
.row { display: flex; align-items: center; }
.spacer { flex: 1; }

/* 调试卡片 */
.debug-card {
  background: #fff9e6;
  border: 1px dashed #f6ad55;
  color: #8a6d3b;
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px;
}
.debug-title { font-weight: 700; margin-bottom: 6px; }
.debug-line { font-size: 13px; line-height: 20px; }
.render-btn {
  margin-top: 10px;
  appearance: none;
  background: #fffa;
  border: 1px solid #f6ad55;
  color: #8a6d3b;
  border-radius: 8px;
  padding: 6px 10px;
}

/* 出货单卡片列表 → 调整为网格，两列（>=768px），单列（移动端），整体更紧凑 */
.outbound-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
  padding: 0 4px;
}
@media (min-width: 768px) {
  .outbound-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

.outbound-card {
  display: flex;
  flex-direction: column;
}

.outbound-container-card {
  background: white;
  border-radius: 16px;
  padding: 12px; /* 由 20px 缩小 */
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.06);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

.outbound-container-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.outbound-container-card:active {
  transform: translateY(0);
}

.outbound-container-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #f8b300;
}

/* 出货单头部样式 */
.outbound-header {
  margin-bottom: 12px; /* 由 20px 缩小 */
}

.header-main {
  margin-bottom: 10px; /* 由 16px 缩小 */
}

.outbound-id {
  font-size: 14px; /* 由 18px 缩小 */
  font-weight: 700;
  color: #000000;
  margin-bottom: 6px; /* 由 8px 缩小 */
  line-height: 1.3;
}

.outbound-title {
  font-size: 13px; /* 由 16px 缩小 */
  color: #000000;
  line-height: 1.35;
}

.outbound-details {
  display: flex;
  flex-direction: column;
  gap: 8px; /* 由 12px 缩小 */
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0; /* 由 8px 缩小 */
}

.detail-label {
  font-size: 12px; /* 由 14px 缩小 */
  color: #000000;
  font-weight: 500;
}

.detail-value {
  font-size: 12px; /* 由 14px 缩小 */
  color: #000000;
  font-weight: 600;
}

.quantity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px; /* 由 8px 缩小 */
  padding-top: 10px; /* 由 12px 缩小 */
  border-top: 1px solid #e2e8f0;
}

.quantity-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
}

.quantity-label {
  font-size: 11px; /* 由 12px 缩小 */
  color: #000000;
  margin-bottom: 3px; /* 由 4px 缩小 */
}

.quantity-value {
  font-size: 14px; /* 由 18px 缩小 */
  font-weight: 700;
  color: #000000;
}



/* 任务区域样式 */
.task-section {
  margin-top: 16px;
}

.section-title {
  font-size: 14px; /* 由 15px 缩小 */
  font-weight: 600;
  color: #000000;
  margin-bottom: 10px; /* 由 12px 缩小 */
  padding-left: 4px;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px; /* 由 12px 缩小 */
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px; /* 由 12px 缩小 */
  padding: 12px; /* 由 16px 缩小 */
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.task-item:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
}

.task-icon {
  font-size: 18px; /* 由 20px 缩小 */
  margin-top: 2px;
}

.task-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-title {
  font-size: 14px; /* 由 15px 缩小 */
  font-weight: 600;
  color: #000000;
}

.task-subtitle {
  font-size: 12px; /* 由 13px 缩小 */
  color: #000000;
  line-height: 1.4;
}

.task-count {
  font-size: 13px; /* 由 14px 缩小 */
  font-weight: 600;
  color: #000000;
  margin-top: 4px;
}

/* 移动端优化（保留） */
@media (max-width: 768px) {
  .outbound-container-card {
    padding: 12px;
    border-radius: 12px;
  }
  
  .outbound-id {
    font-size: 13px;
  }
  
  .outbound-title {
    font-size: 12px;
  }
  
  .task-item {
    padding: 12px;
  }
  
  .quantity-value {
    font-size: 13px;
  }
  
  /* 移动端查询区域样式优化 */
  .search-container {
    padding: 0 10px;
    margin-bottom: 12px;
    max-width: 100%;
  }
  
  .search-input {
    height: 38px;
    font-size: 13px;
    padding: 8px 36px 8px 14px;
  }
  
  .search-btn-icon {
    width: 24px;
    height: 24px;
    right: 8px;
  }
  
  .search-btn-icon svg {
    width: 14px;
    height: 14px;
  }
}


</style> 